package com.nian.gateway.service.simple.controller;

import com.nian.common.model.ServerResponse;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequestMapping("test")
@RestController
public class TestController {

    /**
     * 测试查找接口
     * @param name
     * @return
     */
    @GetMapping("find")
    public ServerResponse find(@RequestParam("name") String name){
        log.info("invoke find param name is : {}", name);
        if(StringUtils.isNotEmpty(name)){
            return ServerResponse.createBySuccess("已找到：name=" + name);
        }
        return ServerResponse.createByErrorMessage("name 参数不能为空!");
    }

}
